/*
package com.longcai.util;

import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

*/
/**
 * 自定义token拦截器
 *
 * @author 作者姓名
 * @description: TODO
 * @Title: TokenInterceptor
 * @date 2019/4/10 14:27
 *//*

public class TokenInterceptor extends HandlerInterceptorAdapter {

    */
/**
     * 进去拦截器后首先进入的方法
     * 返回false则不再继续执行
     * 返回true则继续执行
     *
     * @param request
     * @param response
     * @param handler
     * @return
     *//*

    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) { response.setCharacterEncoding("utf-8");
        String token = request.getHeader("token");
        //拦截
        String url = request.getRequestURI();
        if (url.indexOf("login") != -1 || url.indexOf("register") != -1 || url.indexOf("wx")!=-1) {
            return true;
        } else {
            //token不存在
            if (token != null) {
                //验证token是否正确
                boolean result = JwtUtil.verify(token);
                if (result) {
                    return true;
                }
            }
        }
        return false;
    }

    */
/**
     * 生成视图时执行，可以用来处理异常，并记录在日志中
     * @param request
     * @param response
     * @param arg2
     * @param e
     *//*

    @Override
    public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object arg2, Exception e) {

    }

    */
/** -
     * 生成视图之前执行，可以修改ModelAndView
     *//*

    @Override
    public void postHandle(HttpServletRequest request,
                           HttpServletResponse response,
                           Object arg2, ModelAndView arg3)
            throws Exception{
    }
}
*/
